import 'dart:ui';

import '../worlds/game/GameWorld.dart';
import '../worlds/game/entity/PlantEntity.dart';
import '../worlds/game/model/SeedModel.dart';
import '../worlds/welcome_menu/WelcomeMenuWorld.dart';

// 自动测试游戏
class TestFunction {
  static bool debugTag = false;

  // static bool debugTag = true;
  static List<PlantEntity> list = [
    PlantEntity.peashooter,
    PlantEntity.sunflower,
    PlantEntity.cabbagepult,
    PlantEntity.coffeeBean,
    PlantEntity.cobCannon,
    PlantEntity.cactus,
  ];

  // 自动选择植物
  static void autoSelectPlant(SeedModel seedModel, Function onTap) {
    if (!debugTag) return;
    Future.delayed(Duration(milliseconds: 600), () {
      if (list.contains(seedModel.plantEntity)) {
        onTap();
      }
    });
  }

  // 自动开始
  static void autoBegin(void Function() hover) {
    if (!debugTag) return;
    hover();
  }

  // 自动开始游戏
  static void autoTapStart(VoidCallback onTap) {
    if (!debugTag) return;
    Future.delayed(Duration(milliseconds: 1200), () {
      onTap();
    });
  }

  // 初始路由
  static String initRoute() {
    return debugTag ? GameWorld.routeName : WelcomeMenuWorld.routeName;
  }
}
